package org.shiwen.week12.answer;

public class Q5 {
    public static void main(String[] args) {
        int sum = 1;
        for (int i = 2; i < 1000; i++) {//确定被除数循环
            for (int j = 2; j < i; j++) {//确定除数循环
                if (i % j == 0) {//找到所有因数
                    sum = sum+j;//求和
                }
            }
            if(sum == i){//如果所有因数的和等于自身则输出
                System.out.println(i);
            }
            sum = 1;//重置sum
        }
    }
}
